/**
 * 最基础版本的深拷贝
 * 使用递归的思想
 * 缺点比如：没有考虑数组
 * */ 
function clone (target) {
  if (typeof target === 'object') {
    let cloneTarget = {}
    for (key in target) {
      cloneTarget[key] = clone(target[key])
    }
    return cloneTarget
  } else {
    return target
  }
}

const target = {
  field1: 1,
  field2: undefined,
  field3: 'ConardLi',
  field4: {
      child: 'child',
      child2: {
          child2: 'child2'
      }
  }
};

console.log(clone(target))